package cn.bugstack.springframework.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * @author: yulong
 * @date: 2021/8/13
 */
public class FileSystemResource implements Resource {
    private String path;
    private File file;

    public FileSystemResource(File file) {
        this.file = file;
        this.path = file.getPath();
    }

    public FileSystemResource(String path) {
        this.file = new File(path);
        this.path = path;
    }

    @Override
    public InputStream getInputStream() throws FileNotFoundException {
        FileInputStream fileInputStream = new FileInputStream(path);
        return fileInputStream;
    }


}
